<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--系统管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ul class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li class="active" style="color: #02b87f;"> 修改密码</li>
            </ul>
        </div>
        <div class="panel mgr15 mgl15">
            <div class="panel-heading addCharts" style="background:#ededed;">
                修改密码
            </div>
            <div class="panel-body">
                <form class="form-horizontal adminex-form" action='' method="post" id="sysuser" enctype="multipart/form-data">
                    <div class="form-group" id="ferror2">
                        <label class="col-sm-2 col-sm-2 control-label">旧密码：</label>
                        <div class="col-sm-10">
                            <input type="text" id='old_password' name='old_password' class="form-control" style="width:70%;background: #fff;" autocomplete="off" disableautocomplete   readonly onfocus="this.removeAttribute('readonly');">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">新密码：</label>
                        <div class="col-sm-10">
                            <input type="text" id='newpassword' name='new_password' class="form-control" style="width:70%;background: #fff;" autocomplete="off" disableautocomplete   readonly onfocus="this.removeAttribute('readonly');">
                        </div>
                    </div>
                    <div style="text-align: center">
                        <button type="button" onclick="addform()" class="btn btn-primary">确认修改</button>
                    </div>
                </form>
            </div>
        </div>
        {include file='public/footer'/}

    </div>
</section>
<script src="__STATIC_URL__/static/layer/layer.js"></script>
<script>
    function addform() {
        var old = $("#old_password").val();
        var news = $("#newpassword").val();
        if( old == ""){
            layer.alert("请输入旧密码",{icon:7});
            $("#old_password").focus();
            return false;
        }
        if(news == ""){
            layer.alert("请输入新密码",{icon:7});
            $("#new_password").focus();
            return false;
        }
        var url = "{:url('login/logout')}";
        $.ajax({
            url:"{:url('usersetting/usersetting')}",
            data:$("#sysuser").serialize(),
            type:"post",
            success:function(data){
                if(data.code==0){
                    layer.msg(data.message,{icon:1,time:1000});
                    setTimeout("window.location.href='{:url('login/logout')}'",1000);
                }else{
                    layer.alert(data.message,{icon:7});
                }
            }
        })
    }
</script>
</body>
</html>
